home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d7
/
litecom6.arc
/
LCLIB.EXE
/
LCZM.H
< prev
next >
Wrap
Text File
|
1991-08-27
|
5KB
|
252 lines
/*
** lczm.h - LiteComm ToolBox
** Copyright (c) 1991, Information Technology, Ltd.
** All rights reserved
*/
#ifndef _LCZM_H
#define _LCZM_H
/*
** type definitions
*/
typedef struct
{
unsigned char xxx[3];
unsigned char cmdflag;
} ZRQINITREC;
typedef struct
{
unsigned int rbufsize;
unsigned char xxx;
unsigned char rflags;
} ZRINITREC;
typedef struct
{
unsigned char xxx[3];
unsigned char sflags;
} ZSINITREC;
typedef struct
{
unsigned char xflags;
unsigned char tflags;
unsigned char mflags;
unsigned char cflags;
} ZFILEREC;
typedef struct
{
unsigned char xxx[3];
unsigned char cack;
} ZCOMMREC;
typedef union
{
unsigned char H[9];
struct
{
unsigned char cmd;
union
{
ZRQINITREC zrqi;
ZRINITREC zri;
ZSINITREC zsi;
ZFILEREC zfr;
ZCOMMREC zcr;
unsigned long P;
} u1;
union
{
unsigned long crc32;
unsigned crc16;
} u2;
} s;
} HEADER;
typedef int (*ZSENDHDR)(PROTO *, unsigned char);
/*
** PROTO ctl blk, command
*/
typedef void(*ZSENDDATA)(PROTO *, unsigned char *, unsigned, unsigned char);
/*
** PROTO ctl blk, buffer, buffer length, frame end
*/
typedef unsigned(*ZRECEIVE)(PROTO *, char *, int);
/*
** PROTO ctl blk, buffer, buffer length
*/
/*
** constant definitions
*/
#define ZBUFSIZE 1024
/* command definitions */
#define ZRQINIT 0
#define ZRINIT 1
#define ZSINIT 2
#define ZACK 3
#define ZFILE 4
#define ZSKIP 5
#define ZNAK 6
#define ZABORT 7
#define ZFIN 8
#define ZRPOS 9
#define ZDATA 10
#define ZEOF 11
#define ZFERR 12
#define ZCRC 13
#define ZCHALLENGE 14
#define ZCOMPL 15
#define ZCAN 16
#define ZFREECNT 17
#define ZCOMMAND 18
#define ZSTDERR 19
#define CANCELED 20
#define TIMEDOUT 21
#define USERABORT 22
#define DISCONNECTED 23
#define ZOK 24
#define ZERROR 25
/*
** header state definitions
*/
#define GETZPAD 0
#define GETZDLE 1
#define GETFRAME 2
/*
** send file state definitions
*/
#define WAITFORACK 1
#define GOTACK 2
#define SENDDHDR 3
#define SENDSUBBLOCK 4
#define SENDSUBEND 5
#define SENDEOF 6
/*
** possible error returns from read routines
*/
#define COMNOCARRIER -2
#define COMTIMEDOUT -3
#define COMABORT -4
/*
** rflag definitions
*/
#define CANFDX 0x01
#define CANOVIO 0x02
#define CANBRK 0x04
#define CANCRY 0x08
#define CANLZW 0x10
#define CANFC32 0x20
#define ESCCTL 0x40
#define ESC8 0x80
/*
** cflag definitions
*/
#define CFEMPTY 0
#define CFNOCONV 1
#define CFNLTOCRLF 2
#define CFRESUME 3
/*
** ZMODEM Character constants
*/
#define ZPAD '*'
#define ZDLE 0x18
#define ZDLEE 0x58
#define ZBIN 'A'
#define ZHEX 'B'
#define ZBIN32 'C'
#define ZCRCE 'h'
#define ZCRCG 'i'
#define ZCRCQ 'j'
#define ZCRCW 'k'
#define ZRUB0 'l'
#define ZRUB1 'm'
#define BADCHAR 0xffff
#define GOTOR 0x100
#define GOTCRCE (GOTOR|ZCRCE)
#define GOTCRCG (GOTOR|ZCRCG)
#define GOTCAN (GOTOR|0x18)
#define GOTCRCQ (GOTOR|ZCRCQ)
#define GOTCRCW (GOTOR|ZCRCW)
/*
** Status codes
*/
#define ZPKTLEN 6 /* Packet too long */
#define ZNOCAR 7 /* Lost Carrier */
#define ZXFRCAN 8 /* Transfer cancelled */
#define ZBADHDR 9 /* Bad header received */
#define ZTIMER 10 /* Timeout */
#define ZFOPEN 11 /* Error opening file */
#define ZRECOVER 12 /* Receovering session */
#define ZFCREAT 13 /* Unable to create file */
#define ZDISKERR 14 /* Disk read/write error */
#define ZBADPOS 15 /* Positioning error */
#define ZINITTO 16 /* Timeout during initialization */
#define ZSEEKERR 17 /* File seek error */
#define ZGOTFILE 18 /* Got file header block */
#define ZBADFILE 19 /* Cant find file to send */
/*
** function prototypes
*/
int docrc(unsigned char *, unsigned, unsigned);
long docrc32(unsigned char *, unsigned, long);
int swap(int);
void lczinit(PROTO *, long);
void sendchar(unsigned, unsigned char);
int ztimedread(PROTO *);
void zsendcan(unsigned);
void zputstr(PROTO *, unsigned char *);
void zputhex(PROTO *, unsigned char);
void zsendhexheader(PROTO *, unsigned char);
void zsendbytes(PROTO *, unsigned char *, unsigned);
int zgetzdl(PROTO *);
long zfilecrc32(PROTO *, int);
unsigned receiveda16(PROTO *, char *, int);
unsigned receiveda32(PROTO *, char *, int);
int sendheader32(PROTO *, unsigned char);
int sendheader16(PROTO *, unsigned char);
void senddata32(PROTO *, unsigned char *, unsigned, unsigned char);
void senddata16(PROTO *, unsigned char *, unsigned, unsigned char);
int zgethex(PROTO *);
int zgethexheader(PROTO *);
int zgetbinaryhead(PROTO *);
int zgetbinaryhead32(PROTO *);
int zgetheader(PROTO *);
void lczm_send(PROTO *, long, char **);
void lczm_recv(PROTO *, long, char *);
/*
** global definitions used in both send/receive
*/
extern HEADER txhdr;
extern HEADER rxhdr;
extern unsigned rxcount;
extern unsigned char attn[32];
/*
** function pointers
*/
extern ZSENDHDR sendheader;
extern ZSENDDATA senddata;
extern ZRECEIVE receivedata;
#endif